package com.free.logic.service;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.AnnotationConfiguration;

import com.free.entity.UserEntity;


public class ManangerTest {
	public void testConnection()
	{		
		SessionFactory sf = new AnnotationConfiguration().configure("/com/free/logic/hibernate.cfg.xml").buildSessionFactory();
		Session session = sf.getCurrentSession();
		Transaction ts = session.beginTransaction();
		Object obj = session.createQuery("from User").uniqueResult();
		UserEntity user = (UserEntity)obj;
		System.out.println(user.getUname());
		ts.commit();		
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new ManangerTest().testConnection();
	}

}
